using System;
using System.Collections.Generic;

namespace LannyPractiseCode
{
    /// <summary>
    /// 懒汉式
    /// </summary>
    public class Singleton1
    {
        private static Singleton1 instance = null;
        //02.构造私有化
        private Singleton1() { }
        //03.提供外部访问的接口   返回当前类的对象
        public static Singleton1 getInstance()
        {
            if (instance == null)
            {
                instance = new Singleton1();
            }
            return instance;
        }
    }
}